<?php
// Includes
require_once("myspace\MySpaceAPI.php");
require_once("Config.php"); // <-- SET YOUR KEY/SECRET HERE

// Set the key - application uri - secret key
$myspace = new MySpaceAPI(Config::$APPLICATION_KEY, Config::$APPLICATION_SECRET);

// Get XML, JSON
//$myspace->set_output_array(false); //set to false to get the XML or JSON format instead of native php arrays
//$myspace->set_response_type(ResponseType::$JSON); //change the type to XML, JSON

$enable_photos = true; // run and output the photo REST API
$enable_videos = true; // run and output the videos REST API

//--------------------------------------------------------------------


$user_id = 264730435; // <-- CHANGE to yours (you can get this from the iframe querystring for owner id and viewer id)

    // GETS get-user
    $result = $myspace->get_user($user_id);
    echo 'get_user';
    var_dump($result);

//Sample use of the values as output
echo '<a href="' . $result['weburi'] . '">' . $result['displayname'] . '</a><br/>';
echo '<img src="' . $result['imageuri'] . '"/>';

    echo '<hr>';
     
    //GETS get-profile
    $result = $myspace->get_profile($user_id);
    echo 'get_profile';
    var_dump($result);
    echo '<hr>';
    
$page = 1;
$page_size = 1;
$list = null;
    
    //GETS get-friends
    $result = $myspace->get_friends($user_id, $page, $page_size, $list);
    echo 'get_friends';
    var_dump($result);
    echo '<hr>';
    
$array_ids = array(2, 555111); // <-- CHANGE to list of friends id
    
    //GETS get-friendship
    $result = $myspace->get_friendship($user_id, $array_ids);
    echo 'get_friendship';
    var_dump($result);
    echo '<hr>';
    
if ($enable_photos) {
    
    //GETS get-albums
    $result = $myspace->get_albums($user_id);
    echo 'get_albums';
    var_dump($result);
    echo '<hr>';

$album_id = 795861; // <-- CHANGE to yours
    
    //GETS get-album
    $result = $myspace->get_album($user_id, $album_id);
    echo 'get_album';
    var_dump($result);
    echo '<hr>';
    
    //GETS get-photos
    $result = $myspace->get_photos($user_id);
    echo 'get_photos';
    var_dump($result);
    echo '<hr>';
    
$photo_id = 6284233; // <-- CHANGE to yours
    
    //GETS get-photo
    $result = $myspace->get_photo($user_id, $photo_id);
    echo 'get_photo';
    var_dump($result);
    echo '<hr>';
    
}
    
    //GETS get-interests
    $result = $myspace->get_interests($user_id);
    echo 'get_interests';
    var_dump($result);
    echo '<hr>';
    
    //GETS get-details
    $result = $myspace->get_details($user_id);
    echo 'get_details';
    var_dump($result);
    echo '<hr>';
    
    //GETS get-status
    $result = $myspace->get_status($user_id);
    echo 'get_status';
    var_dump($result);
    echo '<hr>';
    
    //GETS get-mood
    $result = $myspace->get_mood($user_id);
    echo 'get_mood';
    var_dump($result);
    echo '<hr>';

if ($enable_videos) {

    //GETS get-videos
    $result = $myspace->get_videos($user_id);
    echo 'get_videos';
    var_dump($result);
    echo '<hr>';

$video_id = 1; // <-- CHANGE to yours
    
    //GETS get-video
    $result = $myspace->get_video($user_id, $video_id);
    echo 'get_video';
    var_dump($result);
    echo '<hr>';
 
}
    
    //GETS get-groups
    $result = $myspace->get_groups($user_id);
    echo 'get_groups';
    var_dump($result);
    echo '<hr>';    
    
    //GETS get-comments
    $result = $myspace->get_comments($user_id);
    echo 'get_comments';
    var_dump($result);
    echo '<hr>';
    
//--------------------------------------------------------------------

?>
